import { computed, ref } from 'vue';
import { defineStore } from 'pinia';
export const useDeviceStore = defineStore('device', () => {
    const device = ref(new Map());
    const deviceIds = ref([]);
    const deviceById = computed(() => {
        return (id) => device.value.get(id);
    });
    function setDevice(data) {
        data.forEach((item) => {
            device.value.set(item.deviceId, item);
            deviceIds.value.push(item.deviceId);
        });
    }
    return {
        deviceById,
        setDevice,
        deviceIds
    };
});
